<!doctype html>
<html>

<head>
    <head>
        <meta charset="utf-8">
        <title>登录页面</title>
        <script type="text/javascript" src="__PUBLIC__/home/js/jquery.js"></script>
        <script type="text/javascript" src="__PUBLIC__/home/js/layer/layer.js"></script>
        <script type="text/javascript" src="__PUBLIC__/home/js/global.js"></script>
        <script type="text/javascript" src="__PUBLIC__/home/js/layer/laydate/laydate.js"></script>
       </head>
</head>

<body>



<form id="form">
账号：<input type="text" name="name" maxlength="12"><br /><br />

密码：<input type="password" name="pwd" maxlength="20" ><br /><br />

验证码：<input type="text" name="code" /><img onclick="this.src = '{:U('login/verify')}&a='+new Date().getTime()" src="{:U('login/verify')}" /><br /><br />
<button type="button" onclick="login()">登录</button>

</form>
<script>
    function login(){
        var formData=new FormData($("#form")[0]);
        $.ajax({
            type:"post",
            url:"{:U('login/login')}",
            data:formData,
            dataType:'json',
            processData: false,  // 不处理数据
            contentType: false,   // 不设置内容类型
            success:function(res){
                layer.msg(res.msg);
                if(res.res==1 && res.data.url !=undefined){
                    window.location=res.data.url;
                }
            }
        });
    }

</script>
</body>
</html>